#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#include "hash_Normal.h"
#include "hash_NoNormal.h"

void testHashNoNormal1()
{
	HashNoNormal::_HashTable<int, int> h;
	h.Insert(make_pair(6, 1));
	h.Insert(make_pair(9, 1));
	h.Insert(make_pair(23, 1));
	h.Insert(make_pair(66, 1));
	h.Insert(make_pair(90, 1));

	h.Print();
}

void testHashNoNormal2()
{
	HashNoNormal::_HashTable<string, int> h;
	string arr[] = { "苹果", "西瓜", "苹果", "西瓜", "苹果", "苹果", "西瓜", "苹果", "香蕉", "苹果", "香蕉" };
	for (auto& str : arr)
	{
		auto ret = h.Find(str);
		if (ret)
			ret->_kv.second++;
		else
			h.Insert(make_pair(str, 1));
	}
	h.PrintPair();
}

void testHashNormal1()
{
	HashNormal::_HashTable<int, int> h;
	h.Insert(make_pair(6, 1));
	h.Insert(make_pair(9, 1));
	h.Insert(make_pair(23, 1));
	h.Insert(make_pair(66, 1));
	h.Insert(make_pair(90, 1));

	h.Print();
}

void testHashNormal2()
{
	HashNormal::_HashTable<string, int> h;
	string arr[] = { "苹果", "西瓜", "苹果", "西瓜", "苹果", "苹果", "西瓜", "苹果", "香蕉", "苹果", "香蕉" };
	for (auto& str : arr)
	{
		auto ret = h.Find(str);
		if (ret)
			ret->_kv.second++;
		else
			h.Insert(make_pair(str, 1));
	}
	h.Print();
	cout << endl;

	h.Erase("苹果");
	h.Print();
	cout << endl;

	h.Erase("香蕉");
	h.Print();
	cout << endl;

	h.Erase("西瓜");
	h.Print();
	cout << endl;
}

int main()
{
	//testHashNoNormal1();
	//cout << endl;
	//testHashNoNormal2();

//	testHashNormal1();
//	cout << endl;
//	testHashNormal2();

    HashNormal::TestHT3();

	return 0;
}
